<template>
    <ArticleList 
        :memorialId="memorialId" 
        @back-to-list="handleBackToList" 
        @to-article-edit="handleToArticleEdit" 
    />
</template>

<script setup lang="ts">
import ArticleList from '@/components/memorialManagePages/articleList.vue'
import { useRouter, useRoute } from 'vue-router'
import { computed } from 'vue'

const router = useRouter()
const route = useRoute()

const memorialId = computed(() => route.query.memorialId as string)

const handleBackToList = () => {
    router.push('/memorialManage/manageList')
}

const handleToArticleEdit = (id: number | string, type: string) => {
    router.push({
        path: '/memorialManage/articleEdit',
        query: { 
            memorialId: memorialId.value,
            articleId: id,
            type: type
        }
    })
}
</script>